import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn } from 'typeorm';

@Entity()
export class BookSource {
  @PrimaryGeneratedColumn()
  id: number;

  // 存储解析规则，可以包含 ruleBookInfo, ruleToc, ruleContent, ruleSearch, ruleExplore, ruleReview 等
  @Column({ type: 'json', nullable: true })
  rules?: {
    bookSourceName: string;
    bookSourceUrl:string;
    header?:string;
    //搜索规则
    searchUrl:string;
    // 解析小说基本信息所需的规则
    ruleBookInfo?: any;
    // 解析小说目录所需的规则
    ruleToc?: any;
    // 解析小说章节内容所需的规则
    ruleContent?: any;
    // 解析搜索结果所需的规则
    ruleSearch?: any;
    // 解析探索页所需的规则
    ruleExplore?: any;
    // 解析书评页所需的规则
    ruleReview?: any;
    // 网站分类链接
    exploreUrl?: string;
  };

  @CreateDateColumn()
  createdTime: Date;

  @UpdateDateColumn()
  updatedTime: Date;
} 